<template>
    <div>

       <el-row>
            <el-col :span="24">
                <el-button type="primary" @click="openLog" size="medium">新增候选人</el-button>
            </el-col>
        </el-row>
         <el-row>
            <el-col :span="24">
                <!-- 条查 -->
                <div class="grid-content bg-purple-dark">
                  <el-form :inline="true" :model="search" class="demo-form-inline" style="margin-top: 20px;">

                   <el-form-item label="关键词" :label-width="formLabelWidth">
                     <el-input v-model="search.vacancy" placeholder="请输入内容" clearable></el-input>
                   </el-form-item>


                   <el-form-item label="部门" :label-width="formLabelWidth">
                       <el-select v-model="search.employingDepartment" placeholder="请选择" clearable>
                         <el-option
                           v-for="item in dictOne"
                           :value="item.dictValue" 
                           :key="item.dictValue"             
                           :label="item.dictLabel">
                         </el-option>
                       </el-select>
                   </el-form-item>
                   
                   <el-form-item label="职位性质" :label-width="formLabelWidth">
                       <el-select v-model="search.JobNture" placeholder="请选择" clearable>
                         <el-option
                           v-for="item in dictTwo"
                           :value="item.dictValue" 
                           :key="item.dictValue"             
                           :label="item.dictLabel">
                         </el-option>
                       </el-select>
                   </el-form-item>
                  
                   <el-form-item label="学历要求" :label-width="formLabelWidth">
                       <el-select v-model="search.educationalBackground" placeholder="请选择" clearable>
                         <el-option
                           v-for="item in dictThree"
                           :value="item.dictValue" 
                           :key="item.dictValue"             
                           :label="item.dictLabel">
                         </el-option>
                       </el-select>
                   </el-form-item>
                  <br>
                   <el-form-item label="发起时间" :label-width="formLabelWidth">
                   <div class="block">
                    <el-date-picker
                        v-model="checkDate"
                        type="daterange"
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期"
                            unlink-panels
                       value-format="yyyy-MM-dd"
                        >
                        </el-date-picker>
                   </div>
                   </el-form-item>


                      <el-button type="primary" @click="searchCand()" size="medium" style="margin-left: 710px; width: 100px;">搜索</el-button>
                      &nbsp;
                      <!-- 导出 -->
                      <el-button   size="medium"  plain @click="exportExcel()" style="width: 80px;">
                            <i class="el-icon-upload2">导出</i>
                        </el-button>
                  </el-form>
                  </div>
            </el-col>
        </el-row>
        <el-dialog title="新增" :visible.sync="dialogFormVisible">
          <el-form :model="addCandidate">
                    <el-row>
                        <el-col :span="24">
                            <div style="font-size: 20px;">
                                职位信息
                            </div>
                        </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                         <el-form-item label="招聘职位" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.vacancy" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in titleList"
                                    :value="item.id" 
                                    :key="item.id"             
                                    :label="item.jobTitle">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                      </el-col>
                      <el-col :span="12">
                         <el-form-item label="用人部门" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.employingDepartment" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictOne"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                      </el-col>
                    </el-row>
                     <el-row>
                     
                      <el-col :span="24">
                         <el-form-item label="添加流程" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.process" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictFour"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                      </el-col>
                    </el-row>
                      <el-row>
                        <el-col :span="24">
                            <div style="font-size: 20px;">
                                候选人信息
                            </div>
                        </el-col>
                    </el-row>
                      <el-row>
                        <el-col :span="12">
                           <el-form-item label="候选人" :label-width="formLabelWidth">
                                <el-input v-model="addCandidate.name" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                           <el-form-item label="性别" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.sex" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictSix"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                           <el-form-item label="手机号" :label-width="formLabelWidth">
                                <el-input v-model="addCandidate.phone" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                           <el-form-item label="学历" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.educationalBackground" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictThree"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                      <el-row>
                        <el-col :span="12">
                           <el-form-item label="出生日期" :label-width="formLabelWidth">
                                 <el-date-picker
                                    v-model="addCandidate.dob"
                                    type="date"
                                    placeholder="选择日期"
                                    value-format="yyyy-MM-dd HH:mm:ss">
                                  </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                           <el-form-item label="邮箱" :label-width="formLabelWidth">
                                 <el-input v-model="addCandidate.email" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                          <el-form-item label="民族" :label-width="formLabelWidth">
                                 <el-input v-model="addCandidate.nationality" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="婚姻状况" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.maritalStatus" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictFive"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                     <el-row>
                        <el-col :span="12">
                          <el-form-item label="籍贯" :label-width="formLabelWidth">
                                 <el-input v-model="addCandidate.nativePlace" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="参加工作时间" :label-width="formLabelWidth">
                                 <el-date-picker
                                    v-model="addCandidate.workTime"
                                    type="date"
                                    placeholder="选择日期"
                                    value-format="yyyy-MM-dd HH:mm:ss">
                                  </el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                     <el-row>
                        <el-col :span="24">
                          <el-form-item label="个人优势" :label-width="formLabelWidth">
                                 <el-input type="textarea" v-model="addCandidate.personalAdvantages" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        
                    </el-row>
                    <el-row>
                        <el-col :span="24">
                            <div style="font-size: 20px;">
                                求职意向
                            </div>
                        </el-col>
                    </el-row>
                     <el-row>
                        <el-col :span="12">
                          <el-form-item label="期望职位" :label-width="formLabelWidth">
                                 <el-input  v-model="addCandidate.expectedPosition" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                          <el-form-item label="期望薪资" :label-width="formLabelWidth">
                                 <el-input  v-model="addCandidate.salary_Expectation" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                          <el-form-item label="工作地点" :label-width="formLabelWidth">
                                 <el-input v-model="addCandidate.workLocation" autocomplete="off"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="工作性质" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.jobNature" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictTwo"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        
                        <el-col :span="24">
                            <el-form-item label="到岗期限" :label-width="formLabelWidth">
                                <el-select v-model="addCandidate.jobNature" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictSeven"
                                    :value="item.dictValue" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>

          
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="dialogFormVisible = false">取 消</el-button>
            <el-button type="primary" @click="add">确 定</el-button>
          </div>
        </el-dialog>





        <el-row>
            <!-- 展示 -->
              <el-col :span="24"><div class="grid-content bg-purple-dark">
                  <el-table :data="candidateList"  height="550" >
                    <el-table-column label="职位信息">
                        <template slot-scope="scope">
                              <span style="font-weight:500">{{scope.row.name }}</span> &nbsp;&nbsp;&nbsp;
                          
                              <span style="font-weight:500;"> {{scope.row.title}}</span>&nbsp;&nbsp;&nbsp;
                                  <span style="font-weight:500">{{scope.row.applicationTime }}申请</span> &nbsp;&nbsp;&nbsp;
                                  <span style="font-weight:500">{{scope.row.process }}</span> &nbsp;&nbsp;
                              <br>
                              <span style="font-weight:500">{{scope.row.sex }}</span> &nbsp;&nbsp;|&nbsp;
                              <span style="font-weight:500">{{scope.row.age }}</span> &nbsp;&nbsp;|&nbsp;
                              <span style="font-weight:500">{{scope.row.projectExperience }}</span> &nbsp;&nbsp;&nbsp;
                              <br>
                                 <span style="font-weight:500">{{scope.row.workExperience }}</span> &nbsp;&nbsp;|&nbsp;
                                 <span style="font-weight:500">{{scope.row.workTime }}</span> &nbsp;&nbsp;&nbsp;
                              <br>
                              <span style="font-weight:500">北京大学</span> &nbsp;&nbsp;|&nbsp;
                              <span style="font-weight:500">计算机技术</span> &nbsp;&nbsp;|&nbsp;
                              <span style="font-weight:500">本科 &nbsp;{{scope.row.workTime }}</span> &nbsp;&nbsp;&nbsp;
                            

                        </template>
                    </el-table-column>


                    <el-table-column label="操作" width="260">
                        <template slot-scope="scope">
                            <el-button size="medium " type="text" v-if="scope.row.process == '待面试' || scope.row.process == '初筛'" @click="updateStatus(scope.row)">安排面试</el-button>              
                            <el-button size="medium " type="text" v-if="scope.row.process != '人才库'" @click="out(scope.row)">淘汰</el-button>              
                            <el-button size="medium " type="text" v-if="scope.row.process == '待入职'" @click="abandon(scope.row)">放弃</el-button>              
                            <el-button size="medium " type="text" v-if="scope.row.process != '待入职' && scope.row.process != '人才库' && scope.row.process != '面试通过'" @click="pass(scope.row)">通过</el-button>              
                            <el-button size="medium " type="text" v-if="scope.row.process == '面试通过'" @click="fakerOffice(scope.row)">发送office</el-button>  
                            <el-button size="medium " type="text" v-if="scope.row.process == '待入职'" @click="openRuzhi(scope.row)">确认入职</el-button>              
            

                        </template>
                    </el-table-column>
                  </el-table>

                <!-- 分页 -->
                <div class="block">
                    <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="pageNum"
                    :page-sizes="[2, 4, 6, 8]"
                    :page-size="pageSize"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total" style="float:right">
                    </el-pagination>
                </div>
                  </div>
            </el-col>
        </el-row>


        <el-dialog title="操作确认" :visible.sync="dialogForm">
          <el-form :model="addCandidate">
            <div class="aaa">
              {{queding.name}}
              <br>
              {{queding.title}}
              &nbsp;
              |
              职位ID：
              {{queding.jobId}}
               &nbsp;
              |
              投递时间：
              {{queding.applicationTime}}  

            </div>
             <el-form-item label="淘汰原因" :label-width="formLabelWidth" v-if="yuanyin == 1">
                  <el-input  v-model="addCandidate.causeOut" autocomplete="off"></el-input>
            </el-form-item>
             <el-form-item label="放弃原因" :label-width="formLabelWidth" v-if="yuanyin ==2" >
                  <el-input  v-model="addCandidate.causeOut" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="备注" :label-width="formLabelWidth">
                  <el-input type="textarea" v-model="addCandidate.remark" autocomplete="off"></el-input>
            </el-form-item>

             <el-form-item label="添加到人才库" v-if="yuanyin == 1">
              <el-radio-group v-model="addCandidate.state">
                  <el-radio label="0" name="type">备选人才库</el-radio>
                  <el-radio label="1" name="type">淘汰人才库</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="添加到人才库" v-if="yuanyin == 2">
              <el-radio-group v-model="addCandidate.state">
                  <el-radio label="0" name="type">备选人才库</el-radio>
                  <el-radio label="1" name="type">淘汰人才库</el-radio>
              </el-radio-group>
            </el-form-item>
            
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="dialogForm = false">取 消</el-button>
            <el-button type="primary"  @click="updateOut()">确 定</el-button>
            <!-- <el-button type="primary" v-if="this.yuanyin == 2" @click="fangqi()">确 定</el-button> -->
          </div>
        </el-dialog>

        <!-- 安排面试dialog -->
    <el-dialog :visible.sync="apmsDialog">
        <el-form :model="interviewList">
            <h2>{{addCandidate.name}}</h2>
            {{addCandidate.title}}&nbsp;|&nbsp;职位ID:&nbsp;{{addCandidate.jobId}}&nbsp;|&nbsp;投递时间:&nbsp;{{addCandidate.applicationTime}}<br/><br/>
            <div><h2>基本信息</h2></div>
            <el-form-item label="面试方式" :label-width="formLabelWidth">
                    <el-select v-model="interviewList.interviewMethod"  placeholder="请选择">
                        <el-option
                        v-for="item in dictEight"
                        :key="item.dictValue"
                        :label="item.dictLabel"
                        :value="item.dictLabel">
                        </el-option>
                    </el-select>
            </el-form-item>
            <el-form-item label="面试联系人" :label-width="formLabelWidth">
                <el-button class="custom-button" @click="openTreeLog(1)">
                    <span class="icon"><i class="el-icon-plus"></i></span>
                </el-button>
                {{lianxiren}}
            </el-form-item>
            <el-form-item label="面试轮次" :label-width="formLabelWidth">
                <el-input v-model="interviewList.interviewRounds" placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="面试时间" :label-width="formLabelWidth">
                <div class="block">
                    <el-date-picker
                    v-model="interviewList.interviewTime"
                    type="date"
                    placeholder="选择日期"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    >
                    </el-date-picker>
                </div>
            </el-form-item>
            <el-form-item label="面试时长" :label-width="formLabelWidth">
                <el-input v-model="interviewList.interviewDuration"  placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="会议室" :label-width="formLabelWidth">
                <el-input v-model="interviewList.room"  placeholder="请输入"></el-input>
            </el-form-item>
            <el-form-item label="面试官" :label-width="formLabelWidth">
                <el-button class="custom-button" @click="openTreeLog(2)">
                    <span class="icon"><i class="el-icon-plus"></i></span>
                </el-button>
                {{mianshiguan}}
            </el-form-item>
            <div><h2>通知方式</h2></div>
            <el-form-item label="面试官通知" :label-width="formLabelWidth">
                <el-checkbox-group v-model="notice">
                    <el-checkbox label="0">短信通知</el-checkbox>
                    <el-checkbox label="1">邮件通知</el-checkbox>
                    <el-checkbox label="2">站内信通知</el-checkbox>
                </el-checkbox-group>
            </el-form-item>
            <el-form-item label="候选人通知" :label-width="formLabelWidth">
                <el-radio-group v-model="interviewList.candidateNotice" >
                <el-radio label="0">短信通知</el-radio>
                <el-radio label="1">邮件通知</el-radio>
                </el-radio-group>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="apmsDialog = false">取 消</el-button>
            <el-button type="primary" @click="addinterview" >确 定</el-button>
        </div>
        </el-dialog>
    <!-- 安排面试dialog -->
 
    <!-- 树 -->
     <el-dialog title="" :visible.sync="dialogOne">
            <el-form :model="interviewList">
                <el-form-item label="部门" :label-width="formLabelWidth">
                    <el-tree
                    :data="DictTreeList"
                    node-key="id"
                    ref="tree"
                    highlight-current
                    :props="defaultProps"
                    >
                </el-tree>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="dialogOne = false">取 消</el-button>
                <el-button type="primary" @click="getCheckedNodes()">确 定</el-button>
            </div>
        </el-dialog>

         <!-- 发送office的dialog -->
    <el-dialog :visible.sync="officeDialog">
        <el-form :model="officeData">
            <div><h2>候选人信息</h2></div>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="入职职位" :label-width="formLabelWidth">
                        <el-select v-model="officeData.entryPosition"  placeholder="请选择">
                            <el-option
                            v-for="item in titleList"
                            :key="item.id"
                            :label="item.jobTitle"
                            :value="item.id">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="用人部门" :label-width="formLabelWidth">
                                <el-select v-model="officeData.entryDepartment" placeholder="请选择" style="width: 300px;" clearable>
                                    <el-option
                                    v-for="item in dictOne"
                                    :value="item.dictLabel" 
                                    :key="item.dictValue"             
                                    :label="item.dictLabel">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="工作性质" :label-width="formLabelWidth">
                        <el-select v-model="officeData.jobNature" placeholder="请选择">
                        <el-option
                        v-for="item in dictTwo"
                        :key="item.dictValue"
                        :label="item.dictLabel"
                        :value="item.dictLabel">
                        </el-option>
                    </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="预计入职时间" :label-width="formLabelWidth">
                        <el-date-picker
                        v-model="officeData.expectedStartDate"
                        type="date"
                        placeholder="选择日期"
                        value-format="yyyy-MM-dd HH:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="通知方式" :label-width="formLabelWidth">
                        <el-checkbox-group v-model="notification">
                        <el-checkbox label="0" name="type">短信通知</el-checkbox>
                        <el-checkbox label="1" name="type">邮件通知</el-checkbox>
                        </el-checkbox-group>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="发送邮箱" :label-width="formLabelWidth">
                        <el-input v-model="officeData.sendingEmail"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <div><h2>邮件模板</h2></div>
            <el-form-item label="抄送人" :label-width="formLabelWidth">
                <el-input v-model="officeData.carbonCopy"></el-input>
            </el-form-item>
            <el-form-item label="邮件主题" :label-width="formLabelWidth">
                <el-input v-model="officeData.emailSubject"></el-input>
            </el-form-item>
            <el-form-item label="邮件内容" :label-width="formLabelWidth">
                 <MyEditor
                    id="editor"
                    ref="editor"
                    :wordNum="TiLength"
                    v-model="officeData.emailContent"
                    @change="onEditorChange($event)"
                >
                </MyEditor>
            </el-form-item>

            <el-form-item label="上传附件" :label-width="formLabelWidth">
                <el-upload
                    class="upload-demo"
                    action="/api/upload"  
                    :headers="uploadHeaders"
                    :on-change="handleChange"
                    :on-remove="handleRemove"
                    :before-upload="beforeUpload"
                    :on-success="handleSuccess"
                    :on-error="handleError"
                    :limit="5" 
                    :on-exceed="handleExceed"
                    :file-list="fileList"
                     
                    >
                    <el-button>点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">
                        支持扩展名：rar, zip, doc, docx, pdf, jpg，单个文件不超过10MB
                    </div>
                </el-upload>
            </el-form-item>
            <div><h2>短信模板</h2></div>
            <el-form-item label="短信内容" :label-width="formLabelWidth">
                  <MyEditor
                    id="editor"
                    ref="editor"
                    :wordNum="TiLength"
                    v-model="officeData.messageContent"
                    @change="EditorChange($event)"
                >
                </MyEditor>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="officeDialog = false">取 消</el-button>
            <el-button type="primary" @click="sendingOffice()">确 定</el-button>
        </div>
    </el-dialog>
    <!-- 发送office的dialog -->
    <!-- 确认入职dialog -->
    <el-dialog :visible.sync="startWorkDialog">
        <el-form :model="startWorkData">
            {{mingzi}}
            {{shoujihao}}
            <div><h3>基本信息</h3></div>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="邮箱" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.email" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="入职职位" :label-width="formLabelWidth">
                        <el-select v-model="startWorkData.inductionPosition" placeholder="请选择" style="width: 300px;" clearable>
                                <el-option
                                v-for="item in titleList"
                                :key="item.id"
                                :label="item.jobTitle"
                                :value="item.id">
                                </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="实际入职时间" :label-width="formLabelWidth">
                        <el-date-picker
                        v-model="startWorkData.employmentTime"
                        type="date"
                        placeholder="选择日期"
                        value-format="yyyy-MM-dd HH:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
            </el-row>
            <div><h3>个人信息</h3></div>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="出生日期" :label-width="formLabelWidth">
                        <el-date-picker
                        v-model="startWorkData.birthdayTime"
                        type="date"
                        placeholder="选择日期"
                        value-format="yyyy-MM-dd HH:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-col>                   
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="性别" :label-width="formLabelWidth">
                        <el-select v-model="startWorkData.sex" placeholder="请选择" style="width: 300px;" clearable>
                            <el-option
                            v-for="item in dictSix"
                            :key="item.dictValue"
                            :label="item.dictLabel"
                            :value="item.dictLabel">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="婚姻状况" :label-width="formLabelWidth">
                        <el-select v-model="startWorkData.maritalStatus" placeholder="请选择" style="width: 300px;" clearable>
                            <el-option
                            v-for="item in dictFive"
                            :key="item.dictValue"
                            :label="item.dictLabel"
                            :value="item.dictLabel">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="民族" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.nationality" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="籍贯" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.nativePlace" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
                </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="参加工作时间" :label-width="formLabelWidth">
                        <el-date-picker
                        v-model="startWorkData.workingTime"
                        type="date"
                        placeholder="选择日期"
                         value-format="yyyy-MM-dd HH:mm:ss">
                        </el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="政治面貌" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.face" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <div><h3>学历信息</h3></div>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="学历" :label-width="formLabelWidth">
                        <el-select v-model="startWorkData.educationalBackground" placeholder="请选择" style="width: 300px;" clearable>
                            <el-option
                            v-for="item in dictThree"
                            :key="item.dictValue"
                            :label="item.dictLabel"
                            :value="item.dictLabel">
                            </el-option>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                <el-form-item label="结束时间" :label-width="formLabelWidth">
                    <el-date-picker
                    v-model="startWorkData.endTime"
                    type="date"
                    placeholder="选择日期"
                     value-format="yyyy-MM-dd HH:mm:ss">
                    </el-date-picker>
                </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="毕业院校" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.graduatedSchool" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="专业" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.specialized" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <div><h3>紧急联系人</h3></div>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="姓名" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.name" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="关系" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.relationship" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="联系人电话" :label-width="formLabelWidth">
                        <el-input v-model="startWorkData.phone" placeholder="请输入"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <div><h3>审批记录</h3></div>   
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="startWorkDialog = false">取 消</el-button>
            <el-button type="primary" @click="querenruzhi()">确 定</el-button>
        </div>
    </el-dialog>
    <!-- 确认入职dialog -->
    </div>
</template>
<script>
import axios from 'axios'
import { getToken } from '@/util/auth'
import MyEditor from "@/components/MyEditor/editor.vue";
export default {
     components: {
        MyEditor,
    },
   data(){
    return {
         uploadHeaders:{"Authorization": getToken()}, //获取登录值
        candidateList:[],
        dictOne:[],   //部门
        dictTwo:[],   //职业性质
        dictThree:[], //学历
        dictFour:[],  //流程
        dictFive:[],  //婚姻情况
        dictSix:[],  //性别
        dictSeven:[],  //到岗期限
        dictEight:[],  //面试方式
        notification:[],  
        mingzi:'',
        shoujihao:'',
        dialogFormVisible:false,
        dialogForm:false,
        apmsDialog:false,  
        dialogOne:false,
        officeDialog:false,
        startWorkDialog:false,
        formLabelWidth:'120px',
        notice:[],
        startWorkData:[],
        search:{
            vacancy:'',
            JobNture:'',
            employingDepartment:'',
            educationalBackground:'',
            startDate:'',
            endDate:''
        },
        val:'',
        DictTreeList:[],   //树
        lianxiren:'',
        mianshiguan:'',
        yuanyin:null,
        addCandidate:{
          	"age": 0,
            "applicationTime": "",
            "arrivalTime": "",
            "award": "",
            "causeOut": "",
            "dob": "",
            "educationalBackground": "",
            "email": "",
            "employingDepartment": "",
            "endDate": "",
            "expectedPosition": "",
            "id": 0,
            "interviewer": "",
            "jobNature": "",
            "languageAbility": "",
            "learningExperience": "",
            "maritalStatus": "",
            "name": "",
            "nationality": "",
            "nativePlace": "",
            "personalAdvantages": "",
            "phone": "",
            "process": "",
            "projectExperience": "",
            "remark": "",
            "salaryExpectation": "",
            "sex": "",
            "socialPage": "",
            "startDate": "",
            "state": "",
            "title": "",
            "trainingExperience": "",
            "vacancy": "",
            "workExperience": "",
            "workLocation": "",
            "workTime": ""
        },
         //安排面试
        interviewList:{
              "candidateNotice": "",
              "id": 0,
              "interview": "",
              "interviewContact": "",
              "interviewDuration": "",
              "interviewMethod": "",
              "interviewNotice": "",
              "interviewRounds": "",
              "interviewTime": "",
              "room": "",
              candId:''
        },    //安排面试
        queding:{
              name:'',
              title:'',
              jobId:'',
              applicationTime:""
        }
       
        ,
        //发送office
        officeData:{
            "carbonCopy": "",
            "cnadId": 0,
            "emailContent": "",
            "emailSubject": "",
            "entryDepartment": "",
            "entryPosition": "",
            "expectedStartDate": "",
            "fileUpload": "",
            "id": 0,
            "jobNature": "",
            "messageContent": "",
            "notice": "",
            "sendingEmail": ""
        },
        //发送office    
        a:[],
        b:[],
            //确认入职
            startWorkData:{
                "birthdayTime": "",
                "candId": 0,
                "educationalBackground": "",
                "email": "",
                "employmentTime": "",
                "endTime": "",
                "face": "",
                "graduatedSchool": "",
                "id": 0,
                "inductionPosition": "",
                "maritalStatus": "",
                "name": "",
                "nationality": "",
                "nativePlace": "",
                "phone": "",
                "relationship": "",
                "sex": "",
                "specialized": "",
                "workingTime": ""
            },
            //确认入职

        defaultProps:{
            children: 'children',
              label: 'label'
        },
        titleList:[],
        checkDate:[],
        pageNum : 1,
        pageSize : 2,
        total:null,
        TiLength:''
    }
   },
   created(){
    this.findCandList(),
    this.findDict(),
    this.findposition()
   },
   methods:{
    //打开部门树弹框
    openTreeLog(job){
        this.dialogOne = true
        this.findDictTree()
        this.val = job
    },
    //确认入职
    openRuzhi(row){
        this.startWorkDialog = true
        this.mingzi = row.name
        this.shoujihao = row.phone
        this.b = row
    },
    querenruzhi(){
        
        console.log("确认入职",this.startWorkData);
        axios.post("/api/board/addBoard",this.startWorkData).then(res=>{
            if (res.data.code == 200) {
                this.pass(this.b)
            }
        })
        
    },
    pass(row){
        console.log("aaa",row);
        axios.post("/api/cand/updateStateById?id="+row.id + "&process=" + row.process).then(res=>{
            this.findCandList()
        })
    },
    //发送office
    fakerOffice(row){
        this.officeDialog = true
        this.addCandidate = row
        this.a = row
    },
    sendingOffice(){
        this.officeData.notice = this.notification.join(",")
        this.officeData.candId = this.addCandidate.id
        console.log("发送office",this.officeData);
        axios.post("/api/sending/addSending",this.officeData).then(res=>{
            if (res.data.code == 200) {
                this.pass(this.a)
            }
        })
    },
     getCurrentLabel() {
          const currentNode = this.$refs.tree.getCurrentNode();
          return currentNode ? currentNode.label : null;
        },
        //点击确认   
        getCheckedNodes(){
            console.log("aaa",this.$refs.tree.getCheckedNodes());
          let currentLabel = this.getCurrentLabel();
          console.log('aaa',currentLabel);
          if (this.val == 1) {
            this.lianxiren = currentLabel;
            console.log('第一',this.zhaopinfuzeren);
          } else if (this.val == 2) {
            this.mianshiguan = currentLabel
            console.log('第2',this.yongrenjingli);
          }
        },
    //打开新增弹框
    openLog(){
   
      this.addCandidate = {}
      this.dialogFormVisible = true
    },
     //查询部门树
        findDictTree(){
            axios.post("/api/tree/findDepartmentTree",{}).then(res=>{
                this.DictTreeList = res.data.data
            })
        },
        addinterview(){
            this.interviewList.interviewContact = this.lianxiren
            this.interviewList.interview = this.mianshiguan
            this.interviewList.interviewNotice = this.notice.join(",")
            this.interviewList.candId = this.addCandidate.id   //候选人id
            console.log("hiihasioud",this.addCandidate.id);
            
            console.log("安排面试",this.interviewList);
            //新增面试表
            axios.post("/api/interview/addInterview",this.interviewList).then(res=>{
                if (res.data.code == 200) {
                    //成功后修改候选人表流程
                   this.pass(this.addCandidate)
                }
            })
            
        },

    //新增
   add(){
    axios.post("/api/cand/addTemCandidate",this.addCandidate).then(res=>{
      this.findCandList()
      this.dialogFormVisible = false
    })
   },
   //安排面试
   updateStatus(row){
      axios.get("/api/cand/getTemCandidateById?id="+row.id).then (res=>{
      this.addCandidate = res.data.data
    })
    this.interviewList = {}
    this.apmsDialog = true
   },
  
   //淘汰
   out(row){  
    this.dialogForm = true
    this.yuanyin = 1
    axios.get("/api/cand/getTemCandidateById?id="+row.id).then (res=>{
      this.queding= res.data.data
      console.log(this.queding);
           this.addCandidate = {}
    })
   },
   //放弃
   abandon(row){
    this.yuanyin = 2
      this.dialogForm = true
    
       axios.get("/api/cand/getTemCandidateById?id="+row.id).then (res=>{
      this.queding = res.data.data
      this.addCandidate = {}
    })
   },

   updateOut(){
      axios.post("/api/cand/updateTemCandidate",this.addCandidate).then(res=>{
        this.dialogForm = false;
            
       
      })
   },
    //查询候选人
    findCandList(){
        axios.post("/api/cand/findTemCandidateList?pageNum="+this.pageNum + '&pageSize=' + this.pageSize , this.search).then(res=>{
            this.candidateList = res.data.data.items
            this.total = res.data.data.totalElements
            
        })
    },
    //查询职位
    findposition(){
      axios.post("/api/tem/findTemPosition",{}).then(res=>{
        this.titleList = res.data.data
      })
    },
    //查询字典表
     findDict(){
               // 部门 tem_department_type
            axios.post("/api/dict/findDictByType?dictType=tem_department_type").then(res=>{
                this.dictOne = res.data.data
            }),
               // 职业性质 tem_nature_type
            axios.post("/api/dict/findDictByType?dictType=tem_nature_type").then(res=>{
                this.dictTwo = res.data.data
            }),
             // 学历 tem_educational_type
             axios.post("/api/dict/findDictByType?dictType=tem_educational_type").then(res=>{
                this.dictThree = res.data.data
            })
              // 流程 tem_position_process
             axios.post("/api/dict/findDictByType?dictType=tem_position_process").then(res=>{
                this.dictFour = res.data.data
            })
              // 婚姻情况 tem_marital_status
             axios.post("/api/dict/findDictByType?dictType=tem_marital_status").then(res=>{
                this.dictFive = res.data.data
            })
             // 性别 tem_user_sex
             axios.post("/api/dict/findDictByType?dictType=tem_user_sex").then(res=>{
                this.dictSix = res.data.data
            })
             // 到岗期限 tem_duty_deadline
             axios.post("/api/dict/findDictByType?dictType=tem_duty_deadline").then(res=>{
                this.dictSeven = res.data.data
            })
             // 面试方式 tem_interview_method
             axios.post("/api/dict/findDictByType?dictType=tem_interview_method").then(res=>{
                this.dictEight = res.data.data
            })
           
        },


     //分页
        handleSizeChange(val) {
          this.pageSize = val;
          console.log(`每页 ${val} 条`);
          this.initList();
        },
        handleCurrentChange(val) {
          this.pageNum = val;
          console.log(`当前页: ${val}`);
           this.initList()
        },
        searchCand(){
            this.search.startDate=this.checkDate[0];
            this.search.endDate=this.checkDate[1];
            this.findCandList();
        },

         //富文本
        onEditorChange(e) {
            this.officeData.emailContent=e.replace(/<p>\s*<\/p>/g, '').replace(/^<p>(.*)<\/p>$/, '$1')      
            console.log( this.officeData.emailContent, "aaa");
            var reg = /<[^<>]+>/g; //去标签
            // var reg = /<(?!img).*?>/g //去除img以外的所有标签
            var value = e.replace(reg, "");
            value = value.replace(/&nbsp;/gi, ""); //将空格全部替换
            this.TiLength = value.length; //文字长度显示
            console.log(this.TiLength, "  this.TiLength");
            if (this.TiLength <= 20) {
              this.editorHtml = e;
              console.log(this.editorHtml, "this.editorHtml");
            }
            if (this.TiLength > 20) {
              //当长度大于10时,只截取10之前的内容并赋值
              this.$nextTick(() => {
                this.form.content = this.editorHtml;
              });
              this.warnShow = true;
              // this.$message.error("文字最多输入10字!");
              return false;
            }
          },
            //富文本
        EditorChange(e) {
             this.officeData.messageContent=e.replace(/<p>\s*<\/p>/g, '').replace(/^<p>(.*)<\/p>$/, '$1')      
            console.log( this.officeData.messageContent, "bbb");

            var reg = /<[^<>]+>/g; //去标签
            // var reg = /<(?!img).*?>/g //去除img以外的所有标签
            var value = e.replace(reg, "");
            value = value.replace(/&nbsp;/gi, ""); //将空格全部替换
            this.TiLength = value.length; //文字长度显示
            console.log(this.TiLength, "  this.TiLength");
            if (this.TiLength <= 20) {
              this.editorHtml = e;
              console.log(this.editorHtml, "this.editorHtml");
            }
            if (this.TiLength > 20) {
              //当长度大于10时,只截取10之前的内容并赋值
              this.$nextTick(() => {
                this.form.content = this.editorHtml;
              });
              this.warnShow = true;
              // this.$message.error("文字最多输入10字!");
              return false;
            }
          },
         
            // 文件状态改变时的钩子
        handleChange(file, fileList) {
        this.fileList = fileList;
        },
        // 文件移除时的钩子
        handleRemove(file, fileList) {
        this.fileList = fileList;
        },
        // 上传前的校验
        beforeUpload(file) {
        const allowedTypes = [
            "application/x-rar-compressed",
            "application/zip",
            "application/msword",
            "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "application/pdf",
            "image/jpeg",
        ];

        const isAllowedType = allowedTypes.includes(file.type);
        const isLt10MB = file.size / 1024 / 1024 < 10;




        if (!isAllowedType) {
            this.$message.error("只支持上传 rar, zip, doc, docx, pdf, jpg 格式的文件！");
        }
        if (!isLt10MB) {
            this.$message.error("单个文件大小不能超过 10MB！");
        }
        return isAllowedType && isLt10MB;
        },




        // 上传成功时的钩子
        handleSuccess(response, file, fileList) {
        this.$message.success("文件上传成功！");
        console.log("上传成功", response, file, fileList);
        this.officeData.fileUpload = response.data;
        },




        // 上传失败时的钩子
        handleError(err, file, fileList) {
        this.$message.error("文件上传失败，请重试！");
        console.error("上传失败", err, file, fileList);
        },




        // 超出文件数量限制时的钩子
        handleExceed(files, fileList) {
        this.$message.warning(`最多只能上传 ${this.limit} 个文件`);
        },
   }
    


}
</script>
<style scoped>
.aaa{
  width: 100%;
  height:80px;
  background-color: rgb(248,248,248);
  color:black;
  
}
</style>